<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
    <%@include file="common/common.jsp" %>
</head>
<script type="text/javascript">

    var MaskUtil = (function(){
        var $mask,$maskMsg;
        var defMsg = '正在处理，请稍待。。。';
        function init(){
            if(!$mask){
                $mask = $("<div class=\"datagrid-mask mask_index\"></div>").appendTo("body");
            }
            if(!$maskMsg){
                $maskMsg = $("<div class=\"datagrid-mask-msg mask_index\">"+defMsg+"</div>")
                    .appendTo("body").css({'font-size':'12px'});
            }

            $mask.css({width:"100%",height:$(document).height()});

            var scrollTop = $(document.body).scrollTop();

            $maskMsg.css({
                left:( $(document.body).outerWidth(true) - 190 ) / 2
                ,top:( ($(window).height() - 45) / 2 ) + scrollTop
            });
        }
        return {
            mask:function(msg){
                init();
                $mask.show();
                $maskMsg.html(msg||defMsg).show();
            }
            ,unmask:function(){
                $mask.hide();
                $maskMsg.hide();
            }
        }
    }());

    function addTab(node) {
        var content = '<iframe src="' + node.url + '" frameborder="0" style="border:0;width:100%;height:99%;"></iframe>';
        var t = $('#home-tabs');
        var opts = {
            title: node.text,
            // href: node.url,
            content: content,
            closable: true,
            fit: true,
            border: false
        };
        if (t.tabs('exists', opts.title)) {
            var tab = t.tabs("select", opts.title).tabs("getSelected");
            t.tabs('update', {
                tab: tab,
                options: opts
            });
        } else {
            t.tabs('add', opts);
        }

    }


    $(function () {
        $('#home-tree').tree({
            url: '${path}/menuTree/selectMenuTrees',
            onClick: function (node) {
                if (node.url) {
                    addTab(node);
                }
            }
        });
    });




</script>
<body>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north'" style="height:50px;">
        欢迎${userInfo.userName}，<a href="${path}/logout">退出</a>
    </div>
    <div data-options="region:'west',title: ' '" style="width:200px;">
        <ul id='home-tree'>
        </ul>
    </div>
    <div data-options="region:'center'" style="background:#eee;">
        <div id='home-tabs' class='easyui-tabs' style='height: 100%;'>
            <div title="首页">
                <h2 style="text-align: center">欢迎登录晴天人员权限管理系统</h2>
            </div>
        </div>
    </div>
</div>
</body>
</html>
